package com.lf.data.dao;

import java.util.Map;

import com.lf.data.CollectionDAO;
import com.lf.data.Template;
import com.lf.data.search.TemplateSearch;

import com.lf.connect.MongoDB;

public class TemplateDAO extends CollectionDAO {

	public static final String COLLECTION = "c_template";

	public TemplateDAO(MongoDB nosql) {
		super(nosql, COLLECTION);
	}

	public Template removeTemplate(String id) {
		TemplateSearch ts = new TemplateSearch();
		ts.idEQ(id);
		Map<String, Object> m = findAndRemove(ts);
		if (m == null) {
			return new Template();
		} else {
			return new Template(m);
		}
	}
}
